package cn.wbnyua.resume.mvc.mapper;

import cn.wbnyua.resume.mvc.domain.Projects;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ProjectsMapper {

    @Select("select * from projects")
    List<Projects> findAll();
    @Select("select * from projects where id = #{id}")
    Projects findById(Long id);

    @Insert("insert into projects(`name`,intro,info,address,start_time,end_time) values(#{name},#{intro},#{info},#{address},#{startTime},#{endTime}")
    int add(Projects projects);

    @Update("UPDATE `myself`.`projects` SET `name` = #{name}," +
            " `intro` = #{intro}, `info` = #{info}," +
            " `address` = #{address}, `start_time` = #{startTime}, `end_time` = #{endTime} WHERE `id` = #{id}")
    int update(Projects projects);

    @Delete("delete from project where id = #{id}")
    int remove(Long id);
}
